package com.yl.core.listener;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.event.ApplicationStartedEvent;
import org.springframework.boot.context.event.ApplicationStartingEvent;
import org.springframework.context.ApplicationListener;

@Slf4j
public class MyApplicationStartingListener implements ApplicationListener<ApplicationStartingEvent> {

    /**
     * springboot启动开始的时候执行的事件
     * @param event
     */
    @Override
    public void onApplicationEvent(ApplicationStartingEvent event) {
        // log还未加载，使用了也输出不了
        // log.error("ApplicationStartingEvent");
        System.out.println("ApplicationStartingEvent事件发布：" + event.getTimestamp());
    }
}
